selectionmodel: Document the callback apis
authorMatthias Clasen <mclasen@redhat.com>
Sat, 6 Jun 2020 14:36:09 +0000 (10:36 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 6 Jun 2020 14:36:57 +0000 (10:36 -0400)
docs/reference/gtk/gtk4-sections.txt
gtk/gtkselectionmodel.c
gtk/gtkselectionmodel.h

index ddd8b58de3b1aa360cae3826a0e6ba67a1015e30..1e201c96949e821088e01786c6198c4d16ca97da 100644 (file)
@@ -350,6 +350,9 @@ gtk_selection_model_select_range
 gtk_selection_model_unselect_range
 gtk_selection_model_select_all
 gtk_selection_model_unselect_all
+GtkSelectionCallback
+gtk_selection_model_select_callback
+gtk_selection_model_unselect_callback
 gtk_selection_model_query_range
 <SUBSECTION>
 gtk_selection_model_selection_changed
index dfbf167f9a732595a38622fba84ec1f87d5e0654..1bbf277d61257d2849fda3e41c28aeb62b1f4086 100644 (file)
@@ -342,6 +342,15 @@ gtk_selection_model_unselect_all (GtkSelectionModel *model)
   return iface->unselect_all (model);
 }
 
+/**
+ * gtk_selection_model_select_callback:
+ * @model: a #GtkSelectionModel
+ * @callback: a #GtkSelectionCallback to determine items to select
+ * @data: data to pass to @callback
+ *
+ * Requests to select all items for which @callback returns
+ * @selected as TRUE.
+ */
 gboolean
 gtk_selection_model_select_callback (GtkSelectionModel    *model,
                                      GtkSelectionCallback  callback,
@@ -352,6 +361,15 @@ gtk_selection_model_select_callback (GtkSelectionModel    *model,
   return GTK_SELECTION_MODEL_GET_IFACE (model)->select_callback (model, callback, data);
 }
 
+/**
+ * gtk_selection_model_unselect_callback:
+ * @model: a #GtkSelectionModel
+ * @callback: a #GtkSelectionCallback to determine items to select
+ * @data: data to pass to @callback
+ *
+ * Requests to unselect all items for which @callback returns
+ * @selected as TRUE.
+ */
 gboolean
 gtk_selection_model_unselect_callback (GtkSelectionModel    *model,
                                        GtkSelectionCallback  callback,
index 3a73572ac2f1a943faa81626be32b491cecf1960..2a6318d6f23f28c8a5391b052ff6a5cbb9ef5556 100644 (file)
@@ -33,6 +33,25 @@ G_BEGIN_DECLS
 GDK_AVAILABLE_IN_ALL
 G_DECLARE_INTERFACE (GtkSelectionModel, gtk_selection_model, GTK, SELECTION_MODEL, GListModel)
 
+/**
+ * GtkSelectionCallback:
+ * @position: the position to query
+ * @start_range: (out): returns the position of the first element of the range
+ * @n_items: (out): returns the size of the range
+ * @selected: (out): returns whether items in @range are selected
+ * @data: callback data
+ *
+ * Callback type for determining items to operate on with
+ * gtk_selection_model_select_callback() or
+ * gtk_selection_model_unselect_callback().
+ *
+ * The callback determines a range of consecutive items around
+ * @position which should either all
+ * be changed, in which case @selected is set to %TRUE, or all not
+ * be changed, in which case @selected is set to %FALSE.
+ *
+ * @start_range and @n_items are set to return the range.
+ */
 typedef void     (* GtkSelectionCallback) (guint     position,
                                            guint    *start_range,
                                            guint    *n_items,